#ifndef __TCP_SERVER_H__
#define __TCP_SERVER_H__
#include<string>
#include<sstream>
class IpAddressPort;
struct Msg
{
    std::string m_msg;
    int m_numberofRecvBytes;

    Msg(std::string msg, int numberofRecvBytes):m_msg(msg),m_numberofRecvBytes(numberofRecvBytes){}
    std::string ToString()const
    {
        std::stringstream ss;
        ss<<"[recmsg: "<<m_msg<<"],[numberOfByte:"<<m_numberofRecvBytes<<"]";
        return ss.str();
    }
};


class TcpServer
{
private:
    int m_lfd;
public:
    TcpServer(const IpAddressPort&);
    ~TcpServer();
    int Accept();
    int SendMsg(int ,const std::string &msg);
    Msg RecvMsg(int);
    int GetLfd()const;
};

#endif